<template>
  <div>
    <el-container>
      <el-header>Header</el-header>
      <el-container>
        <el-aside width="200px">Aside</el-aside>
        <el-main>Main</el-main>
      </el-container>
    </el-container>


  </div>
</template>
<script>
import * as echarts from "echarts";

export default {
  data() {
    return{
      chartInstance:null,
      testXArr:[],
      testYArr:[],
      isGraph:0
    }
  },
  // mounted() {
  //   this.initChart()
  // },

  methods: {
    changeData() {
      if (this.isGraph===1){
        this.testXArr =  ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        this.testYArr = [132,2,11,92,55,2,100]
        this.chartInstance.clear()
        this.initChart()
        this.isGraph = 0
      }
      else {
        this.testXArr =  ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        this.testYArr = [13,32,41,12,55,2,1]
        this.initChart()
        this.isGraph = 1
      }

    },
    initChart() {
      this.chartInstance = echarts.init(document.getElementById(1+''));
      const option = {
        xAxis: {
          type: 'category',
          data: this.testXArr
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: this.testYArr,
            type: 'line'
          }
        ]
      }
      this.chartInstance.setOption(option)
    }
  }
}
</script>
<style scoped>
.el-header, .el-footer {
  background-color: #B3C0D1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #D3DCE6;
  color: #333;
  text-align: center;
  line-height: 200px;
  height: 100vh;
}

.el-main {
  background-color: #E9EEF3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>
